<template lang="pug">
  keep-alive
    kalix-table(bizKey="maintainItem" v-bind:title="title" v-bind:targetURL="targetURL"
    v-bind:bizDialog="bizDialog" v-bind:isFixedColumn="isFixedColumn" v-bind:dialogOptions="dialogOptions"
    v-bind:toolbarBtnList="toolbarBtnList"
    v-bind:btnList="btnList" ref="maintainItemTable")
      template(slot="tableColumnSlot")
        el-table-column(prop="stem" label="题干" align="center" )
        el-table-column(prop="standerItem" label="评分项" align="center" )
        el-table-column(prop="itemScore" label="总分数" align="center" )
        el-table-column(prop="itemDeductScore" label="扣分" align="center" )
        el-table-column(prop="standerItemScore" label="打分" align="center" )
</template>

<script type="text/ecmascript-6">
  import {MaintainItemBtnList} from './itemConfig.js'

  export default {
    name: 'kalix-exam-maintainitem',
    props: {
      examScoreId: {
        type: Number,
        default: -1
      },
      title: {
        type: String,
        default: ''
      }
    },
    data() {
      return {
        bizDialog: [
          {id: 'view', dialog: 'MaintainItemView'},
          {id: 'edit', dialog: 'MaintainItemEdit'}
        ],
        dialogOptions: {},
        isFixedColumn: true,
        targetURL: '/camel/rest/examings/' + this.examScoreId + '/maintainitem',
        toolbarBtnList: [
          {id: 'add', isShow: false}
        ],
        btnList: MaintainItemBtnList
      }
    },
    watch: {
      examScoreId(newValue) {
        this.dialogOptions = {
          examScoreId: newValue
        }

        this.targetURL = '/camel/rest/examings/' + newValue + '/maintainitem'
      }
    }
  }
</script>

<style scoped lang="stylus">
</style>
